﻿using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using SilverPop.UI.Services;
using SilverPop.UI.Views;

namespace SilverPop.UI.Modules
{
	public class DiagramModule : IModule
	{
		private readonly IRegionManager _regionManager;
		private readonly IUnityContainer _unityContainer;

		public DiagramModule(IRegionManager regionManager, IUnityContainer unityContainer)
		{
			_regionManager = regionManager;
			_unityContainer = unityContainer;
		}

		public void Initialize()
		{
			// Register our data service as a singleton so it only loads once
			_unityContainer.RegisterInstance<INoteDataService>(new NoteDataService());

			_regionManager.RegisterViewWithRegion("TitleArea", typeof(TitleBarView));
			_regionManager.RegisterViewWithRegion("CanvasArea", typeof(NoteCanvasView));
		}
	}
}
